const p1 = Promise.resolve(3);
const p2 = new Promise((resolve) => setTimeout(resolve, 100, "foo"));
//const p3 = fetch("https://api.example.com/data");

Promise.all([p1, p2]) // , p3
  .then(values => {
    console.log("所有任务完成:", values);
  })
  .catch(error => {
    console.error("其中一个任务失败:", error);
  });